rcupdate: Implement rcu_barrier() to synchronously flush RCU work.
authorKeir Fraser <keir@xen.org>
Fri, 14 Jan 2011 14:16:42 +0000 (14:16 +0000)
committerKeir Fraser <keir@xen.org>
Fri, 14 Jan 2011 14:16:42 +0000 (14:16 +0000)
Signed-off-by: Keir Fraser <keir@xen.org>
xen/common/rcupdate.c
xen/include/xen/rcupdate.h

index b93c1db6971d9ff342d9ada4d097face2792e49c..9087a56d9ccc2fbc8d46d5148d6509acfa7f242d 100644 (file)
@@ -44,6 +44,7 @@
 #include <xen/percpu.h>
 #include <xen/softirq.h>
 #include <xen/cpu.h>
+#include <xen/stop_machine.h>
 
 /* Definition for rcupdate control block. */
 struct rcu_ctrlblk rcu_ctrlblk = {
@@ -60,6 +61,30 @@ static int qhimark = 10000;
 static int qlowmark = 100;
 static int rsinterval = 1000;
 
+static int rcu_barrier_action(void *unused)
+{
+    unsigned int cpu = smp_processor_id();
+
+    ASSERT(!local_irq_is_enabled());
+    local_irq_enable();
+
+    while ( rcu_needs_cpu(cpu) )
+    {
+        rcu_check_callbacks(cpu);
+        process_pending_softirqs();
+        cpu_relax();
+    }
+
+    local_irq_disable();
+
+    return 0;
+}
+
+int rcu_barrier(void)
+{
+    return stop_machine_run(rcu_barrier_action, NULL, NR_CPUS);
+}
+
 static void force_quiescent_state(struct rcu_data *rdp,
                                   struct rcu_ctrlblk *rcp)
 {
index bb4af9d6e0608d967799426cf679e6ff1b208a34..09802bd622313720c0efecfa0c364228997f13e1 100644 (file)
@@ -197,4 +197,6 @@ void rcu_check_callbacks(int cpu);
 void fastcall call_rcu(struct rcu_head *head, 
                        void (*func)(struct rcu_head *head));
 
+int rcu_barrier(void);
+
 #endif /* __XEN_RCUPDATE_H */